/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.pub.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.modules.pub.entity.PubWelfare;
import com.thinkgem.jeesite.modules.pub.dao.PubWelfareDao;

/**
 * 单表生成Service
 * @author zmy
 * @version 2019-04-18
 */
@Service
@Transactional(readOnly = true)
public class PubWelfareService extends CrudService<PubWelfareDao, PubWelfare> {
	
	@Autowired
	private PubWelfareDao pubWelfareDao;

	public PubWelfare get(String id) {
		return super.get(id);
	}
	
	public List<PubWelfare> findList(PubWelfare pubWelfare) {
		return super.findList(pubWelfare);
	}
	
	public Page<PubWelfare> findPage(Page<PubWelfare> page, PubWelfare pubWelfare) {
		return super.findPage(page, pubWelfare);
	}
	
	@Transactional(readOnly = false)
	public void save(PubWelfare pubWelfare) {
		super.save(pubWelfare);
	}
	
	@Transactional(readOnly = false)
	public void delete(PubWelfare pubWelfare) {
		super.delete(pubWelfare);
	}

	@Transactional(readOnly = false)
	public int updatelike(String articleid, String type) {
		if("1".equals(type)) {
			return pubWelfareDao.updatelike(articleid);
		}else {
			return pubWelfareDao.updatecollect(articleid);
		}
	}

	@Transactional(readOnly = false)
	public int wxsave(String id, String title, String authorname, String article, String imgurl, String authorid,
			String publishtime, String videourl, String category) {
		// TODO Auto-generated method stub
		return pubWelfareDao.wxsave(id,title,authorname,article,imgurl,authorid,publishtime,videourl,category);
	}

	public List<Object[]> welfareList() {
		// TODO Auto-generated method stub
		return pubWelfareDao.welfareList();
	}

	public List<Object[]> welfareListBytype(String category) {
		// TODO Auto-generated method stub
		return pubWelfareDao.welfareListBytype(category);
	}
		
	
	
}